//
//  sdl_ffplay_clock.h
//  FFmpegDemo
//
//  Created by xiaerfei on 2019/7/23.
//  Copyright © 2019 erfeixia. All rights reserved.
//

#ifndef sdl_ffplay_clock_h
#define sdl_ffplay_clock_h

#include <stdio.h>

typedef struct Clock {
    double pts;           /* clock base */
    double pts_drift;     /* clock base minus time at which we updated the clock */
    double last_updated;
    double speed;
    int serial;           /* clock is based on a packet with this serial */
    int paused;
    int *queue_serial;    /* pointer to the current packet queue serial, used for obsolete clock detection */
} Clock;


double get_clock(Clock *c);

void set_clock_at(Clock *c, double pts, int serial, double time);

void set_clock(Clock *c, double pts, int serial);

void set_clock_speed(Clock *c, double speed);

void sync_clock_to_slave(Clock *c, Clock *slave);

void init_clock(Clock *c, int *queue_serial);


#endif /* sdl_ffplay_clock_h */
